package cn.larry.common.utils;

/**
 * This is created,
 * but not necessarily updated by me.
 * Therefore, AUTHOR is useless.
 * 2023/3/10 09:29
 * 【配置文件加密】
 *
 * @Version 1.0
 */

import org.jasypt.util.text.BasicTextEncryptor;
public class DefaultEncryptor{

    public static void main(String[] args) {

//        java -jar -Djasypt.encryptor.password=12345678 xxxx.jar

        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
        //加密所需的salt(盐)
        textEncryptor.setPassword("qaz123");
        //要加密的数据（数据库的用户名或密码）
        String username = textEncryptor.encrypt("12345678");
        String password = textEncryptor.encrypt("larry");
        System.out.println("username:"+username);
        System.out.println("password:"+password);
    }

}

